package com.ruoyi.hospital.service.doctor.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.hospital.mapper.doctor.DocCommonDrugMapper;
import com.ruoyi.hospital.domain.doctor.DocCommonDrug;
import com.ruoyi.hospital.service.doctor.IDocCommonDrugService;

/**
 * 常用药Service业务层处理
 * 
 * @author wendao
 * @date 2025-01-21
 */
@Service
public class DocCommonDrugServiceImpl implements IDocCommonDrugService 
{
    @Autowired
    private DocCommonDrugMapper docCommonDrugMapper;

    /**
     * 查询常用药
     * 
     * @param id 常用药主键
     * @return 常用药
     */
    @Override
    public DocCommonDrug selectDocCommonDrugById(Integer id)
    {
        return docCommonDrugMapper.selectDocCommonDrugById(id);
    }

    @Override
    public DocCommonDrug selectDocCommonDrug(Integer drugId,Integer docId) {
        return docCommonDrugMapper.selectDocCommonDrug(drugId,docId);
    }

    /**
     * 查询常用药列表
     * 
     * @param docCommonDrug 常用药
     * @return 常用药
     */
    @Override
    public List<DocCommonDrug> selectDocCommonDrugList(DocCommonDrug docCommonDrug)
    {
        return docCommonDrugMapper.selectDocCommonDrugList(docCommonDrug);
    }

    /**
     * 新增常用药
     * 
     * @param docCommonDrug 常用药
     * @return 结果
     */
    @Override
    public int insertDocCommonDrug(DocCommonDrug docCommonDrug)
    {
        docCommonDrug.setCreateTime(DateUtils.getNowTimeSecond());
        return docCommonDrugMapper.insertDocCommonDrug(docCommonDrug);
    }

    /**
     * 修改常用药
     * 
     * @param docCommonDrug 常用药
     * @return 结果
     */
    @Override
    public int updateDocCommonDrug(DocCommonDrug docCommonDrug)
    {
        docCommonDrug.setUpdateTime(DateUtils.getNowTimeSecond());
        return docCommonDrugMapper.updateDocCommonDrug(docCommonDrug);
    }

    /**
     * 批量删除常用药
     * 
     * @param ids 需要删除的常用药主键
     * @return 结果
     */
    @Override
    public int deleteDocCommonDrugByIds(Integer[] ids)
    {
        return docCommonDrugMapper.deleteDocCommonDrugByIds(ids);
    }

    /**
     * 删除常用药信息
     * 
     * @param id 常用药主键
     * @return 结果
     */
    @Override
    public int deleteDocCommonDrugById(Integer id)
    {
        return docCommonDrugMapper.deleteDocCommonDrugById(id);
    }
}
